import request from "@/utils/request";

export function getData({ search, status }, { page, page_size }) {
  return request({
    url: "/system-set/role",
    method: "get",
    params: { search, status, page, page_size }
  });
}

export function getAccessData(is_join_access) {
  return request({
    url: "/access/menu/all-menu-access",
    method: "get",
    params: { is_join_access }
  });
}

export function getRoleAccess(id) {
  return request({
    url: "/access/role/detail",
    method: "get",
    params: { id }
  });
}

export function postAddData({ role_name, role_desc, status, access_ids }) {
  return request({
    url: "/access/role",
    method: "post",
    data: { role_name, role_desc, status, access_ids }
  });
}

export function putEditData(id, { role_name, role_desc, status, access_ids }) {
  return request({
    url: "/access/role",
    method: "put",
    data: { id, role_name, role_desc, status, access_ids }
  });
}

export function deleteData(id) {
  return request({
    url: "/system-set/role",
    method: "delete",
    data: { id }
  });
}
